import { Entity, JoinColumn, OneToOne } from 'typeorm';
import { BaseToken } from './baseToken.entity';
import { AccessToken } from './accessToken.entity';

@Entity('fresh_token')
export class FreshToken extends BaseToken {
  @OneToOne(
    (type) => AccessToken,
    (accessToken: AccessToken) => accessToken.freshToken,
    {
      onDelete: 'CASCADE',
    },
  )
  @JoinColumn()
  accessToken!: AccessToken;
}
